<?php

/**
 * Tramites form base class.
 *
 * @method Tramites getObject() Returns the current form's model object
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseTramitesForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'             => new sfWidgetFormInputHidden(),
      'nombre'         => new sfWidgetFormInputText(),
      'descripcion'    => new sfWidgetFormTextarea(),
      'quien'          => new sfWidgetFormInputText(),
      'lugar'          => new sfWidgetFormTextarea(),
      'documentacion'  => new sfWidgetFormTextarea(),
      'pasos'          => new sfWidgetFormTextarea(),
      'costos'         => new sfWidgetFormInputText(),
      'visitas'        => new sfWidgetFormInputText(),
      'tema_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Tema'), 'add_empty' => false)),
      'institucion_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Instituciones'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'id'             => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'nombre'         => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'descripcion'    => new sfValidatorString(array('required' => false)),
      'quien'          => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'lugar'          => new sfValidatorString(array('required' => false)),
      'documentacion'  => new sfValidatorString(array('required' => false)),
      'pasos'          => new sfValidatorString(array('required' => false)),
      'costos'         => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'visitas'        => new sfValidatorInteger(array('required' => false)),
      'tema_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Tema'))),
      'institucion_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Instituciones'))),
    ));

    $this->widgetSchema->setNameFormat('tramites[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Tramites';
  }

}
